package com.skivingcloud.admin.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import io.swagger.annotations.ApiOperation;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2   //开启swagger2
public class SwaggerConfig {
    @Bean//配置swagger的Docket的bean实例
    public Docket docket(){
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
                //RequestHandlerSelectors 配置要扫描接口的方式
                .apis(RequestHandlerSelectors.withClassAnnotation(ApiOperation.class))
                //过滤路径
                //ant()过滤的路径
                // .paths(PathSelectors.ant("/"))
                .build();
    }
}